<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" type="image/x-icon"
	href="${ctxPath}/static/images/lukk.ico" media="screen" />
<link rel="icon" href="${ctxPath}/static/images/lukk.ico"
	type="image/x-icon" />
<link rel="bookmark" href="${ctxPath}/static/images/lukk.ico"
	type="image/x-icon" />

<title>管理页面</title>
</head>
<body class="sticky-header"
	onload="indexmenu('${oneMenu}','${twoMenu}');">
	<%@ include file="../index/index.jsp"%>
	<section>
		<div class="main-content" style="overflow-y: auto">
			<!-- 地址栏-->
			<div class="page-heading">
				<h3>鹿客帮</h3>
				<ul class="breadcrumb">
					<li><a>提现信息审核 </a></li>
					<li class="active">待审核师傅</li>
				</ul>
			</div>
			<div class="panel-body" style="padding-bottom: 0px;">
				<div class="panel panel-default">
					<div class="panel-heading">查询条件</div>
					<div class="panel-body" style="height: 65px">
						<form id="formSearch" class="form-horizontal">
							<input type="hidden" id="queryForm" value="disable">
							<div class="form-group" style="">
								<div class="form-inline col-md-2">
									名称：<input type="text" class="form-control"
										id="txt_search_workerName">
								</div>
								<div class="form-inline col-md-2">
									手机：<input type="text" class="form-control"
										id="txt_search_phoneNumber">
								</div>
								<div class="form-inline col-md-2">
									省份： <select id="allocatedProvinceSelect" name=""
										class="selectpicker show-tick form-control"
										data-live-search="false">
									</select>
								</div>
								<div class="form-inline col-md-2" style="text-align: left;">
									<button type="button" style="margin-left: 50px" id="btn_query"
										class="btn btn-primary">查询</button>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div id="toolbar" class="btn-group">
					<label> &nbsp;&nbsp;&nbsp;&nbsp;注释：提现业务只限于可以正常使用客户端的人员</label>
				</div>
				<table id="tb_worker"></table>
			</div>
		</div>
	</section>
	<!--  查看详细modal  -->
	<div class="modal fade" style="top: 60px; height: 1000px"
		id="viewWorkerDetialModal" tabindex="-1" role="dialog"
		aria-labelledby="viewWorkerDetialModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 1000px; height: 1000px">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="viewWorkerDetialModalLabel">查看师傅的详细信息</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" id="modifyPotentialWorkerForm"
						role="form">
						<input type="hidden" name="id" id="txt_workerID">
						<div class="form-group">
							<label for="txt_phoneNumber" class="col-md-2 control-label">工人头像</label>
							<div class="col-md-4">
								<img src="" id="workerImg" alt="Cinque Terre">
							</div>
							<div class="col-md-6">
								<div role="div">
									<div class="form-group">
										<label for="txt_workerName" class="col-md-4 control-label">师傅名称</label>
										<div class="col-md-7">
											<input type="text" class="form-control" id="txt_workerName">
										</div class="col-md-1">
										<div></div>
									</div>
									<div class="form-group">
										<label for="txt_workerPhone" class="col-md-4 control-label">师傅手机</label>
										<div class="col-md-7">
											<input type="text" class="form-control" id="txt_workerPhone">
										</div class="col-md-1">
										<div></div>
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label for="txt_phoneNumber" class="col-md-2 control-label">身份证前后</label>
							<div class="col-md-4">
								<img src="" id="workerFaceCardImg" alt="Cinque Terre">
							</div>
							<label for="txt_phoneNumber" class="col-md-1 control-label"></label>
							<div class="col-md-4">
								<img src="" id="workerBackCardImg" alt="Cinque Terre">
							</div>
							<label for="txt_phoneNumber" class="col-md-1 control-label"></label>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
</body>
<!-- tables插件的引用 -->
<script src="${ctxPath}/static/js/bootstrap-table/bootstrap-table.js"></script>
<link href="${ctxPath}/static/js/bootstrap-table/bootstrap-table.css"
	rel="stylesheet" />
<script
	src="${ctxPath}/static/js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>

<script type="text/javascript">
	//查看待审核员工详细信息
	function viewWorkerDetialModalOpen(id) {
		var viewRow = $('#tb_worker').bootstrapTable('getRowByUniqueId', id);
		$("#txt_workerName").val(viewRow.name);
		$("#txt_workerPhone").val(viewRow.phone);
		$("#workerImg").attr(
				"src",
				"http://okwc9gyzs.bkt.clouddn.com/" + viewRow.headImg
						+ "?imageView2/1/w/350/h/250");
		$("#workerFaceCardImg").attr(
				"src",
				"http://okwc9gyzs.bkt.clouddn.com/" + viewRow.faceIdCard
						+ "?imageView2/1/w/350/h/250");
		$("#workerBackCardImg").attr(
				"src",
				"http://okwc9gyzs.bkt.clouddn.com/" + viewRow.backIdCard
						+ "?imageView2/1/w/350/h/250");
		$('#viewWorkerDetialModal').modal('show');
	}
	var TableInit = function() {
		var oTableInit = new Object();
		//初始化Table
		oTableInit.Init = function() {
			$('#tb_worker')
					.bootstrapTable(
							{
								url : '${ctxPath}/worker/queryWorkerWithDrawalInfo', //请求后台的URL（*）
								method : 'post', //请求方式（*）
								toolbar : '#toolbar', //工具按钮用哪个容器
								striped : true, //是否显示行间隔色
								cache : false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
								pagination : true, //是否显示分页（*）
								sortable : false, //是否启用排序
								sortName : 'workerSpace',
								sortOrder : "desc", //排序方式
								queryParams : oTableInit.queryParams,//传递参数（*）
								sidePagination : "server", //分页方式：client客户端分页，server服务端分页（*）
								pageNumber : 1, //初始化加载第一页，默认第一页
								pageSize : 10, //每页的记录行数（*）
								pageList : [ 10, 25, 50, 100 ],
								search : false, //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
								strictSearch : false,
								showColumns : false, //是否显示所有的列
								showRefresh : true, //是否显示刷新按钮
								minimumCountColumns : 2, //最少允许的列数
								clickToSelect : false, //是否启用点击选中行
								height : 600, //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
								uniqueId : "workerId", //每一行的唯一标识，一般为主键列
								showToggle : true, //是否显示详细视图和列表视图的切换按钮
								cardView : false, //是否显示详细视图
								detailView : false, //是否显示父子表
								contentType : 'application/x-www-form-urlencoded; charset=UTF-8',
								columns : [
										{
											field : 'name',
											title : '师傅名称',
											width : '8%',
											align : "center"
										},
										{
											field : 'workerSpace',
											title : '工作区市',
											width : '15%'
										},
										{
											field : 'phone',
											title : '师傅手机',
											width : '10%',
											align : "center"
										},
										{
											field : 'registerDate',
											title : '注册时间',
											width : '10%'
										},
										{
											field : 'age',
											title : '工龄',
											width : '8%'
										},
										{
											field : 'withdrawalStatus',
											title : '提现状态',
											width : '8%',
											formatter : function(value, row,
													index) {
												console.info(value);
												if (value == 1) {
													return "可以提现";
												} else {
													return "拒绝提现";
												}
											}
										},
										{
											field : 'tag',
											title : '查看详细信息',
											width : '10%',
											formatter : function(value, row,
													index) {
												return "<button class='btn btn-info btn-xs' onclick='javascript:viewWorkerDetialModalOpen("
														+ row.workerId
														+ ")'>查看详细信息</button>";
											}
										},
										/* {
											field : 'tag2',
											title : '审核操作',
											width : '8%',
											formatter : function(value, row,
													index) {
												return "<button class='btn btn-danger btn-xs' onclick='javascript:disabledWorker("
														+ row.workerId
														+ ")'>关闭提现业务</button>";
											}
										}, */ ]
							});
		};

		//得到查询的参数
		oTableInit.queryParams = function(params) {
			var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
				limit : params.limit, //页面大小
				offset : params.offset, //页码
				order : params.order,
				sort : params.sort,
				workerName : $('#txt_search_workerName').val(),
				provinceCode : $('#allocatedProvinceSelect').val(),
				phoneNumber : $('#txt_search_phoneNumber').val(),
				withdrawalStatus : 1
			};
			return temp;
		};
		return oTableInit;
	};
	$(function() {
		$.post('${ctxPath}/province/queryAllocatedProvinces', function(data) {
			$("#allocatedProvinceSelect").append(
					"<option value='0'>全部省份" + "</option>");
			$(data).each(
					function(index, currData) {
						$("#allocatedProvinceSelect").append(
								"<option value="+currData.areaCode+">"
										+ currData.name + "</option>");
					});
			//1.初始化Table
			var oTable = new TableInit();
			oTable.Init();
			$("#btn_query").click(function() {
				var opt = {
					
					pageNumber : 1,
					query : {
						offset : 0
					}
				};
				//从新开始计数
				$("#tb_worker").bootstrapTable('refresh', opt);
			});
		});
	});
</script>
<script src="${ctxPath}/static/js/jquery.nicescroll.js"></script>
</html>
